package com.chengsi.result;

/**
 * name:                         <br/>
 * 功能:                          <br/>
 * 作者: 君                       <br/>
 * 时间: 2024/08/31/12:32
 */
public class RequestResult<T> {
    private int code;
    private String msg;
    private T data;


    //操作成功结果集
    public static <T> RequestResult<T> success(T data){
        return new RequestResult<>(200, "success", data);
    }

    //操作失败结果集
    public static <T> RequestResult<T> error(int code, String msg){
        return new RequestResult<>(code, msg, null);
    }



    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public RequestResult(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {}
}
